package com.mew.common.rest.user;

import com.mew.common.entity.user.Profile;
import com.mew.common.rest.MewResponse;
import io.netty.buffer.ByteBuf;
import lombok.*;

/** 玩家钱包
 * @author dylin
 * @create 2021/5/17
 */
@Data
@ToString(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UserMoneyResponseMessage extends MewResponse<UserMoneyResponseMessage> {
    private long goldNumber;//筹码
    private long jewelNumber;//砖石
    private long couponNumber;//点券

    public UserMoneyResponseMessage(Profile profile){
        goldNumber = profile.getGoldNumber();
        jewelNumber = profile.getJewelNumber();
    }

    public void byProfile(Profile profile){
        goldNumber = profile.getGoldNumber();
        jewelNumber = profile.getJewelNumber();
    }

    @Override
    public void write(ByteBuf b) {
        writeLong(b,goldNumber);
        writeLong(b,jewelNumber);
        writeLong(b,couponNumber);
    }

    @Override
    public UserMoneyResponseMessage read(ByteBuf byteBuf) {
        return null;
    }
}
